import request from '@/config/axios'
import {OrderParams} from "@/api/h5/type";

/**
 * 获取商品详情
 * */
export const getProductDetail = (params: { id: string }) => {
  return request.get({
    url: '/app-api/product/product/get', params,
  })
}

/**
 * 获取sku
 * */
export const getProductSku = (params: {
  product: string;
}) => {
  return request.get({
    url: '/app-api/product/product/getSpecsByProductId', params
  })
}
// 获取套餐
export const getPackage = (params: {
  product: string;
}) => {
  return request.get({
    url: '/app-api/product/product/getThaliByProductId', params
  })
}
// 获取评论
export const getComment = (params: {
  product: string;
}) => {
  return request.get({
    url: '/app-api/product/product/getProductComment', params
  })
}
// 获取推荐商品
export const getRecommend = (params: {
  product: string;
}) => {
  return request.get({
    url: '/app-api/product/product/getProductRecommend', params
  })
}
// 获取政策
export const getPolicy = (params: {
  product: string;
}) => {
  return request.get({
    url: '/app-api/website/web-service-policy/service-policy-detail/list-by-service-policy-id', params
  })
}

/**
 * 获取地区
 * */
export const getAreaById = (params: {
  areaId: string;
}) => {
  return request.get({
    url: '/app-api/trade/globe-state/getFilterStateDetailId', params


  })
}
//
// /**
//  * 获取地区
//  * */
// export const getProvinceByAreaId = (params: {
//   areaId: string;
// }) => {
//   return request.get({
//     url: '/app-api/trade/globe-state-detail/getFilterDetailStateId', params
//   })
// }


/**
 * 查询隐私政策
 * */
export const getPrivacy = (params: {
  areaId: string
}) => {
  return request.get({
    url: '/app-api/product/product/getSpecsByProductId', params
  })
}


/**
 * 获取物流方式
 * */
export const getLogistics = (params: {
  areaId: string
}) => {
  return request.get({
    url: '/app-api/trade/globe-state-method/getList', params
  })
}


/**
 * 获取物流方式
 * */
export const getAreaList1 = (params: {
  areaId: string;
  methodId:string
}) => {
  return request.get({
    url: '/app-api/trade/globe-state-harvest/getHarvestStateMethodIdList', params
  })
}



/**
 * 获取物流方式
 * */
export const getStoreList = (params: {
  areaId: string
}) => {
  return request.get({
    url: '/app-api/trade/globe-state-harvest/getGlobeStateHarvestMethodList', params
  })
}

/**
 * 根据物流方式获取地区
 * */
export const getAreaListByLogisticsId = (params: {
  methodId: number
}) => {
  return request.get({
    url: '/app-api/trade/globe-state-harvest-two/getGlobeStateHarvestTwoMethodList', params
  })
}




/**
 * 提交订单
 * */
export const submitOrder = (params: OrderParams) => {
  return request.post({
    url: '/app-api/trade/product-order/create', data: params
  })
}


/**
 * 获取物流方式
 * */
export const getConfig = () => {
  return request.get({
    url: '/app-api/trade/order-quantity/page', params: {
      pageNo: 1,
      pageSize: 1
    }
  })
}


/**
 * 获取偏远地区列表
 * */
export const getRemoteArea = (params) => {
  return request.get({
    url: '/app-api/trade/globe-state-remote/getGlobeStateRemoteListPage', params
  })
}


/**
 * 获取物流介绍
 * */
export const getInstruction = (params) => {
  return request.get({
    url: '/app-api/trade/globe-state-instructions/getInstructionsStateId', params
  })
}


/**
 * 根据订单号查订单
 * */
export const getOrder = (params) => {
  return request.get({
    url: '/app-api/trade/product-order/get', params
  })
}

/**
 * 根据订单号查订单
 * */
export const spm = (params:{
  productId:string;
  siteDomain:string;
  productName:string;
  action:number;
  pageType:number;
  accessAddress:string;
  productType:string;
  actionDetail:string
}) => {
  return request.post({

    url: '/app-api/website/web-access-record/create', data:params
  })
}

